home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
bathints.zip
/
BH_07.DOC
< prev
next >
Wrap
Text File
|
1988-10-16
|
12KB
|
205 lines
BAT-HINT # 7
**************************************************************************
from the BATHINTS library... part of the BATPOWER CONFERENCE from:
THE PAINFRAME OPUS/FIDO 261/1004
Baltimore, Maryland (301) 488-7461
**************************************************************************
ANSI.SYS ESCAPE SEQUENCES
ANSI.SYS is a console/video driver that provides a measure of user control
greater than that of DOS. To harness this control, you must first load the
driver as a configuration command in CONFIG.SYS, then reboot your system.
Include the following line in your CONFIG.SYS file:
device=ansi.sys
If the ANSI.SYS file is not in the directory from which you boot, be sure to
include a path (and a drive specifier if necessary). For example, if
ANSI.SYS resides in your DOS subdirectory on your hard drive C, then change
the CONFIG.SYS statement to read:
device=c:\dos\ansi.sys
All ANSI.SYS commands begin with the escape character (ASCII code 27)
followed by a left square bracket ([). Three methods for entering the
escape character will be detailed here: 1) from the command line using the
prompt command, 2) using the DOS line editor EDLIN and 3) via popular word
processors.
The escape character may be entered from the command line (or in a batch
file) using the PROMPT command. The PROMPT code for escape is $e as shown
in the following example:
prompt $e ==== ESC
To enter an ANSI.SYS command however, the statement above must also include
the left square bracket thus:
prompt $e[ ==== ESC[
The prompt command itself is used to enter the escape character since DOS
does not provide a direct method whereby the escape character may be entered
other than through the PROMPT command. The PROMPT method may be used at the
command line directly or in a batch file.
The escape character may also be entered using EDLIN. This method is
confusing to many since the text that is initially entered using EDLIN
appears different than the same text viewed later using EDLIN.
After calling up EDLIN and once in insert mode, perform the following
keystrokes to enter the escape character:
hold down the control (ctrl) key and press V then [
You must hold the ctrl key down while pressing first V then [. This
keystroke sequence will hereinafter be noted as CTRL-V[ or ESC. Note that
the left bracket in the CTRL-V[ sequence IS NOT the left square bracket
needed to complete the beginning of the ANSI.SYS command. To enter an
ANSI.SYS command you need yet another left square bracket. Thus you would:
hold down the CTRL key and press V then [ then release the CTRL key
and press [
to enter the beginning of an ANSI.SYS command. To further complicate
matters, Edlin will echo the escape character as ^V[ and will echo the
completed ANSI.SYS leader as ^V[[ but when the page or list command is
used, EDLIN will echo the completed ANSI.SYS leader as [^[ in version 3.x
of DOS.
Many popular word processing programs also allow the user to enter the
escape character using the ALT key and numeric keypad (for example,
WordPerfect and Microsoft Word). Use ASCII code 27 for entering the escape
character. For example, with WordPerfect:
hold down the ALT key and press 2 then 7 on the numeric keypad
(do not use the number keys situated above your alphabet keys)
When you lift your finger off the ALT key after pressing 27, a left arrow
will appear... this is the escape character. When using your word processor
for such entries, be sure to save your file as an ASCII text file (for
example, use the CTRL-F5 Text In/Out key in WordPerfect). Again, the text
you entered will appear differently after you save the file and retrieve it
with your word processor.
The ANSI.SYS Commands
---------------------
ANSI.SYS commands are of the general form:
ESC[#
followed by a letter. The number symbol (#) shown above is meant to
represent a digit or series of digits and semicolons appropriate for that
command. The commands are shown below in tabular form:
----------------------------------------------------------------------------
COMMAND FUNCTION DETAILS
----------------------------------------------------------------------------
ESC[#A moves cursor up the column is not changed; # ranges from
by # of rows 1-24; if # is omitted, the cursor will be
moved up one row
----------------------------------------------------------------------------
ESC[#B moves cursor the column is not changed; # ranges from
down by # of 1-24; if # is omitted, the cursor will be
rows moved down one row
----------------------------------------------------------------------------
ESC[#C moves cursor the row is not changed; # ranges from
right by # of 1-79; if # is omitted, the cursor will be
columns moved right one column
----------------------------------------------------------------------------
ESC[#D moves cursor the row is not changed; # ranges from
left by # of 1-79; if # is omitted, the cursor will be
columns moved left one column
----------------------------------------------------------------------------
ESC[#;#H moves cursor the first # specifies the row and ranges
or to row # and from 1-20; the second # specifies the
ESC[#;#f column # (row column and ranges from 1-79; if row # is
is the first # omitted, the cursor is moved to row 1; if
and column is column # is omitted, the cursor is moved
the second #) to column 1; if both row # and column #
are omitted, the cursor is moved to row 1
and column 1 (the home position); enter
the semicolon when row # is omitted
----------------------------------------------------------------------------
ESC[s saves cursor stores current cursor position; stored
position position can be implemented with restore
----------------------------------------------------------------------------
ESC[u restores cursor restores cursor to position saved with
position save command
----------------------------------------------------------------------------
ESC[2J erases display erases screen; similar to CLS DOS command
----------------------------------------------------------------------------
ESC[K erases to end erases display from cursor position to the
of line end of that line
----------------------------------------------------------------------------
ESC[=#h sets display sets display to monochrome or color and
mode sets graphics resolution; # ranges from
0-7; # codes are shown below:
0 25 rows x 40 cols, monochrome
1 25 rows x 40 cols, color
2 25 rows x 80 cols, monchrome
3 25 rows x 80 cols, color
4 200 x 320 graphics, color
5 200 x 320 graphics, monochrome
6 200 x 640 graphics, monochrome
7 turn on line wrap, lines longer than
80 characters wrapped to next line
----------------------------------------------------------------------------
ESC[=7l t